<!--
 * @Author: Null
 * @Date: 2022-08-23 18:30:22
 * @Description: 首页
-->

<template>
  <div class="Index">
    <MyAgGrid :loading="loading" :tableOptions="tableOptions"></MyAgGrid>
  </div>
</template>

<script setup>
import { ref, reactive, toRaw, onMounted, onBeforeMount } from "vue";
import MyAgGrid from "@/components/MyAgGrid/index.vue";
import { InitColumnDefs } from "@components/MyAgGrid/common/agGrid-utils";
import {
  userTableConfig,
  userTableMockData,
} from "@components/MyAgGrid/fields/userTable";
const loading = ref(false);
const tableOptions = reactive({
  rowData: [],
  columnDefs: [],
});

onBeforeMount(async () => {
  loading.value = true;
  const initCof = new InitColumnDefs();
  const colList = await initCof.judgeReadServerFieldsData(userTableConfig);
  tableOptions.columnDefs = colList;
});

onMounted(() => {
  const rowData = userTableMockData.getRowData();
  tableOptions.rowData = userTableMockData.getRowData();
  loading.value = false;
});
</script>

<style lang="scss" scoped>
.Index {
  height: calc(100vh - 100px);
}
</style>
